<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">
<h:head>
    <title>Личный кабинет</title>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
    <h:outputStylesheet library="css" name="table-style.css"/>
    <f:view locale="#{userBean.locale}"/>



</h:head>
<h:body>
    <ui:decorate template="/sample.xhtml">
        <ui:define name="body">
            <br/><br/><br/>
            <h:panelGroup rendered="#{!userBean.moderator}">
                Вы не относитсь к администрации сайта
            </h:panelGroup>
            <h:panelGroup rendered="#{userBean.moderator}">
                Список всех пользователей, видят только модераторы

                <h:form>
                    <h:dataTable value="#{adminBean.users}" var="item"
                                 styleClass="order-table"
                                 headerClass="order-table-header"
                                 rowClasses="order-table-odd-row,order-table-even-row">
                            >
                        <h:column>

                            <f:facet name="header" >
                                <h:outputText value="ID" />
                            </f:facet>
                            <h:outputText value="#{item.id}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Логин:" />
                            </f:facet>
                            <h:outputText value="#{item.login}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Пароль" />
                            </f:facet>
                            <h:outputText value="#{item.pass}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="email" />
                            </f:facet>
                            <h:outputText value="#{item.email}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Редактирование" />
                            </f:facet>
                            <h:commandButton value="Редактировать" >
                                <f:param name="id_user" value="#{item.id}"/>
                            </h:commandButton>
                            <h:commandButton value="Удалить" action="#{adminBean.delete}" >
                                <f:param name="id_user" value="#{item.id}"/>
                            </h:commandButton>
                        </h:column>
                    </h:dataTable>
                </h:form>


            </h:panelGroup>

        </ui:define>
    </ui:decorate>


</h:body>


</html>



